package com.nuanshui.heatedloan.fund.integration.pay.bean;

import com.nuanshui.heatedloan.fund.integration.form.PayForm;
import com.nuanshui.heatedloan.fund.integration.pay.execute.PayConfirmHandler;

import java.io.Serializable;
import java.util.List;

public class PayConfirmHandlerMeta  implements Serializable,Comparable<PayConfirmHandlerMeta>{
	
	private PayConfirmHandler payConfirmHandler;
	
	private int order;//排序
	
	private String name;
	
	private List<String> suportPayTypes;//支持的支付类型
	
	private List<String> nonsupportPayTypes;//不支持的支付类型

	
	
	

	

	public List<String> getSuportPayTypes() {
		return suportPayTypes;
	}

	public void setSuportPayTypes(List<String> suportPayTypes) {
		this.suportPayTypes = suportPayTypes;
	}

	public List<String> getNonsupportPayTypes() {
		return nonsupportPayTypes;
	}

	public void setNonsupportPayTypes(List<String> nonsupportPayTypes) {
		this.nonsupportPayTypes = nonsupportPayTypes;
	}

	public PayConfirmHandler getPayConfirmHandler() {
		return payConfirmHandler;
	}

	public void setPayConfirmHandler(PayConfirmHandler payConfirmHandler) {
		this.payConfirmHandler = payConfirmHandler;
	}

	public int getOrder() {
		return order;
	}

	public void setOrder(int order) {
		this.order = order;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public int compareTo(PayConfirmHandlerMeta o) {
		
		return (this.order-o.getOrder())*-1;
	}
	
	
	public boolean matchs(PayForm payForm) {
		if(nonsupportPayTypes!=null && nonsupportPayTypes.size()>0) {//支持的参数不为空
			if(nonsupportPayTypes.contains(payForm.getPayType())) return false;	
		}
		
		if(suportPayTypes!=null && suportPayTypes.size()>0) {
			if(!suportPayTypes.contains(payForm.getPayType())) return  false;
		}
		
		return true;
	}
	
	
	
	

}
